package com.bbzn.device.client.service.impl;

import com.bbzn.device.client.dto.process.FlowDTO;
import com.bbzn.device.client.utils.PageInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.bbzn.device.client.dataobject.Flow;
import com.bbzn.device.client.dao.process.FlowMapper;
import com.bbzn.device.client.service.FlowService;

@Service
public class FlowServiceImpl implements FlowService {

    @Resource
    private FlowMapper flowMapper;

    @Override
    public int deleteByPrimaryKey(Long flowId) {
        return flowMapper.deleteByPrimaryKey(flowId);
    }

    @Override
    public int insert(Flow record) {
        return flowMapper.insert(record);
    }

    @Override
    public int insertOrUpdate(Flow record) {
        return flowMapper.insertOrUpdate(record);
    }

    @Override
    public int insertOrUpdateSelective(Flow record) {
        return flowMapper.insertOrUpdateSelective(record);
    }

    @Override
    public int insertSelective(Flow record) {
        return flowMapper.insertSelective(record);
    }

    @Override
    public Flow selectByPrimaryKey(Long flowId) {
        return flowMapper.selectByPrimaryKey(flowId);
    }

    @Override
    public int updateByPrimaryKeySelective(Flow record) {
        return flowMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Flow record) {
        return flowMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<Flow> findByAll(Flow flow) {
        return flowMapper.findByAll(flow);
    }

    @Override
    public int updateBatch(List<Flow> list) {
        return flowMapper.updateBatch(list);
    }

    @Override
    public int updateBatchSelective(List<Flow> list) {
        return flowMapper.updateBatchSelective(list);
    }

    @Override
    public int batchInsert(List<Flow> list) {
        return flowMapper.batchInsert(list);
    }

    @Override
    public PageInfo<Flow> selectPageBySelective(FlowDTO record) {
        PageInfo<Flow> pageInfo = new PageInfo<>();
        pageInfo.setPageNum(record.getPageNum());
        pageInfo.setPageSize(record.getPageSize());
        pageInfo.setResultList(flowMapper.selectPageBySelective(record));
        int count = flowMapper.selectCountBySelective(record);
        pageInfo.setTotalRecord(count);
        return pageInfo;
    }

    @Override
    public Flow findOneByOrderNo(String orderNo) {
        return flowMapper.findOneByOrderNo(orderNo);
    }
}


